function gettime(){
    $.ajax({
        'url':'/gettime',
        success:function(data){
            $('#date').html(data)
        },
    })

};
function getdata(){
    $.ajax({
        'url':'/getdata',
        success:function(data){
            $('.num h1').eq(0).text(data['confirm']);
            $('.num h1').eq(1).text(data['suspect']);
            $('.num h1').eq(2).text(data['heal']);
            $('.num h1').eq(3).text(data['dead']);
        },
    })

};
function m2(){
    $.ajax({
        'url':'/m2',
        success:function(data){
            m2_option.series[0].data = data.data
            m2_myChart.setOption(m2_option)
        },
    })

};
function l1(){
    $.ajax({
        'url':'/l1',
        success:function(data){
            l1_option.xAxis.data = data['date_list']
            l1_option.series[0].data = data['confirm_list']
            l1_option.series[1].data = data['heal_list']
            l1_option.series[2].data = data['suspect_list']
            l1_option.series[3].data = data['dead_list']
            l1_myChart.setOption(l1_option)
        },
    })

};
function l2(){
    $.ajax({
        'url':'/l2',
        success:function(data){
            l2_option.xAxis.data = data['date_list']
            l2_option.series[0].data = data['new_confirm_list']
            l2_option.series[1].data = data['new_suspect_list']
            l2_myChart.setOption(l2_option)
        },
    })

};
function r1(){
    $.ajax({
        'url':'/r1',
        success:function(data){
            r1_option.xAxis.data = data['city_list']
            r1_option.series[0].data = data['confirm_list']
            r1_option.series[0].label.show = "True"
            r1_option.series[0].label.position = 'top'
            r1_myChart.setOption(r1_option)
        },
    })

};

function r2(){
    $.ajax({
        'url':'/r2',
        success:function(data){
            r2_option.series[0].data = data.data
            r2_myChart.setOption(r2_option)
        },
    })

};
setInterval(gettime,1000)
// setInterval(getdata,1000)

getdata();
// gettime();
r1()
r2()
l1();
l2();
m2()


// setInterval(m2,1000)
// setInterval(l1,1000)